<html>
<head>
<title>Structure Elements</title>
<link rel="stylesheet" href="css/general.css" type="text/css"/>
</head>
<body>
<h1>Structuring Elements <? from 1 to echo $i;?></h1>

<?php
// Obtains variables from show project.php  
$project_id = $_GET['project_id'];

//Database connection
$dbc = mysqli_connect('localhost', 'root', '', 'ism')
	or die("Connection failed");
$query = "SELECT * FROM element WHERE project_id='$project_id'";
$result = mysqli_query($dbc, $query)
	or die("Query failed!");
$i = 1;	
echo '<table border="1"><tr><td>';
//Lists all the elements that we are going to structure
while($row = mysqli_fetch_array($result)){
	echo $i.'. '.$row['statement']."<br />";
	$i++;
}
//Obtains the total of elements and establishes the variable $long
$query = "SELECT * FROM project WHERE id='$project_id'";
$result = mysqli_query($dbc, $query)
	or die("Query failed!");
while($row = mysqli_fetch_array($result)){
	$long=$row['number_elements'];
}

$a=1;
$b=2;
echo '</td><td>';
for($iteration=1;$iteration<=$long; $iteration++){

echo 'Element '.$a.' affects '.$b.' significantly
<br>
<form method="post" action="structure.php?project_id='.$project_id.'">
 <INPUT type="radio" name="no" value="0"> No<BR>
 <INPUT type="radio" name="yes" value="1"> Yes<BR>
<INPUT type="radio" name="yes" value="1"> Who knows???<BR>
<p><input type="Submit" value="Update Matrix!!"/></p>
 </form>';
}

echo '</td></tr></table>';
?>
</body>
</html>